package IO;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 86185
 * Date: 2023-11-28
 * Time: 23:16
 */
public class Demo8 {
    public static void main(String[] args) throws IOException {
        try(InputStream inputStream = new FileInputStream("D:/test.txt")) {
            Scanner scanner = new Scanner(inputStream);
            //从文件中读取
            while (scanner.hasNext()) {
                String s = scanner.next();
                System.out.print(s + " ");
            }
        }
    }
}
